package com.dataart.productshop.service.impl;

import com.dataart.productshop.dao.LecturerDao;
import com.dataart.productshop.model.boiko.informationsystem.Lecturer;
import com.dataart.productshop.service.LecturerManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

@Service
@Transactional
public class LecturerManagerImpl extends BaseManagerImpl<Lecturer> implements LecturerManager {

    @Autowired
    public void setLecturerDao(LecturerDao dao){
        lecturerDao = dao;
        setBaseDao(dao);
    }


    /**
     *
     * @param name
     * @return not null :)
     */
    public List<Lecturer> getLecturerByName(String name){
        List<Lecturer> lects = lecturerDao.getLecturerByName(name);

        return lects == null ? new ArrayList<Lecturer>(1) : lects;
    }

    public List<Lecturer> getLecturerByNameQuery(String query){
        List<Lecturer> lects = lecturerDao.getLecturerByNameQuery(query);
        return lects == null ? new ArrayList<Lecturer>(1) : lects;
    }



}
